package com.csit.service.impl;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.csit.bean.Pager;
import com.csit.dao.DataDictionaryDao;
import com.csit.entity.DataDictionary;
import com.csit.service.DataDictionaryService;
import com.csit.util.ListAndJsonUtil;

@Service
public class DataDictionaryServiceImpl extends BaseServiceImpl<DataDictionary, Integer> implements DataDictionaryService {
	
	@Resource
	DataDictionaryDao dataDictionaryDao;
	
	@Resource
	public void setBaseDao(DataDictionaryDao dataDictionaryDao) {
		super.setBaseDao(dataDictionaryDao);
	}

	public String queryDataDictionary(Pager pager, DataDictionary dataDictionary) {
		if(pager==null){
			pager = new Pager();
		}
		if(dataDictionary==null){
			dataDictionary = new DataDictionary();
		}
		String[] propertiesName = {"dataDictionaryID","dataDictionaryType","dataDictionaryName","note"};
		pager = dataDictionaryDao.queryDataDictionary(pager, dataDictionary);
		String jsonArray = ListAndJsonUtil.getJSONString(pager.getList(), propertiesName, pager.getTotalCount());
		return jsonArray;
	}
	
}
